# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=qmidinet
pkgver=0.9.11
pkgrel=1
pkgdesc="A MIDI Network Gateway via UDP/IP Multicast"
arch=(loong64 x86_64)
url="https://qmidinet.sourceforge.io"
license=(GPL-2.0-or-later)
groups=(pro-audio)
depends=(
  gcc-libs
  glibc
  hicolor-icon-theme
  qt6-base
  qt6-svg
)
makedepends=(
  alsa-lib
  cmake
  jack
  qt6-tools
)
optdepends=(
  'qt6-wayland: for native wayland support'
)
source=(https://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('b656899c155c6a891a74c6c2419206821e99340fc3e11958d00997b74cd46c47c657db641d9f29b01a866dfdb42c87656607aa73eadd71cfbf9bd0107c0c0aa3')
b2sums=('0fe31dabe1b54e6ec41a03b17c28e2232039d5a7009fbbdbdec5c95df88d15bbfa8dbd5f2ad80821bdc137e60cd76fe6a7bb4b2da037146c6b298ede8011b00b')

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CONFIG_QT6=ON
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

package() {
  depends+=(
    alsa-lib libasound.so
    jack libjack.so
  )

  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README} -t "$pkgdir/usr/share/doc/$pkgname"
}
